import axios from "axios";

const request = axios.create({
    baseURL: "https://www.hellokitty.live",
    timeout: 10000,
    headers: {
        'Content-Type': 'application/json; charset=utf-8',
    }
})
request.interceptors.request.use(config => {
        return config;
    },error => {
        return Promise.reject(error);
})
request.interceptors.response.use(response => {
        const { data } = response 
        if(data.code !== 200){
            return Promise.reject(data);
        }
        return data;
    },error => {;
        return Promise.reject(error.response.data ||error.response);
})

export default request;